import Mock from 'mockjs'
import {menuList} from "@/mock/menuList";

// console.log(63, menuList)

interface loginFormData {
    userName: string,
    password: string,
    checked: boolean
}

interface loginInt {
    url: string,
    type: string,
    body: string
}

Mock.mock('/api/login', 'post', (params: loginInt) => {
    const param = params.body
    console.log(23, param)
    let data
    if (param) {
        data = JSON.parse(param)
    }
    if (data.userName === 'admin' && data.password === '123456') {
        return {
            code: 200,
            data: {
                token: 'access_token'
            },
            message: '登录成功'
        }
    } else {
        return {
            code: 500,
            data: '',
            message: '登录失败'
        }
    }
})

Mock.mock('/api/getMenuList', 'get', (params: loginInt) => {
    // const param = params.body
    console.log(9999999, params)
    return {
        code: 200,
        data: menuList,
        message: '登录成功'
    }
})
